package com.agileboot.domain.airport.report.db;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 安全信息表 Mapper 接口
 */
public interface SirReportMapper extends BaseMapper<SirReportEntity> {
    @Delete("DELETE FROM sir_report WHERE inspection_check_id = #{inspectionCheckId}")
    int deleteByInspectionCheckId(@Param("inspectionCheckId") Long inspectionCheckId);


    @Update("UPDATE sir_report SET status = #{status} WHERE report_id = #{reportId}")
    int updateStatusByReportId(@Param("reportId") Long reportId, @Param("status") String status);


    @Select("<script>" +
            "SELECT * FROM sir_report " +
            "WHERE inspection_check_id IN " +
            "<foreach collection='inspectionCheckIds' item='item' open='(' separator=',' close=')'>" +
            "#{item}" +
            "</foreach>" +
            "</script>")
    List<SirReportEntity> getByInspectionCheckIdList(@Param("inspectionCheckIds") List<Long> inspectionCheckIds);

}
